import request from '@/utils/request'

// 管理员查询商品列表列表
export function listProducts(param) {
  return request({
    url: '/product/products/list',
    method: 'get',
    params: param
  })
}
export function UserlistProducts(param){
  return request({
    url: 'product/products/ulist',
    method: "get",
    params: param
  })
}

// 查询商品列表详细
export function getProducts(pId) {
  return request({
    url: '/product/products/'+pId,
    method: 'get'
  })
}

// 新增商品列表
export function addProducts(data) {
  return request({
    url: '/product/products',
    method: 'post',
    data: data
  })
}

// 修改商品列表
export function updateProducts(data) {
  return request({
    url: '/product/products',
    method: 'put',
    data: data
  })
}

// 删除商品列表
export function delProducts(pId) {
  return request({
    url: '/product/products/' + pId,
    method: 'delete'
  })
}
export function getAllCategoriesName(){
  return request({
    url: '/product/categories',
    method: 'get'
  })
}
// 设为推荐
export function recommendProducts(pId){
  return request({
    url:'/product/products/recommend/'+pId,
    method:'post'
  })
}
